<?php

use think\migration\Migrator;
use think\migration\db\Column;

class System extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $this->table('system', ['comment' => '系统设置表'])
            ->addColumn('name', 'string', ['null' => true, 'comment' => '网站标题'])
            ->addColumn('android_version', 'string', ['null' => true, 'comment' => '安卓版本'])
            ->addColumn('android_url', 'string', ['null' => true, 'comment' => '安卓地址'])
            ->addColumn('ios_version', 'string', ['null' => true, 'comment' => '苹果版本'])
            ->addColumn('ios_url', 'string', ['null' => true, 'comment' => '苹果地址'])
            ->addColumn('update_desc', 'string', ['null' => true, 'comment' => '更新内容'])
            ->addColumn('up_ios', 'string', ['null' => true, 'comment' => '苹果上架版本'])
            ->addColumn('create_time', 'integer', ['default' => 0])
            ->addColumn('update_time', 'integer', ['default' => 0])
            ->addColumn('delete_time', 'integer', ['null' => true])
            ->create();
    }
}
